package com.zhanghe.study.springcloudalibaba.controller;

import com.zhanghe.study.springcloudalibaba.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zh
 * @date 2021/9/15 16:16
 */
@RestController
@RequestMapping("/account")
public class AccountController {
    @Autowired
    private AccountService accountService;

    @PostMapping("/decrease")
    public void decrease(@RequestParam("userId") int userId, @RequestParam("money") double money) throws InterruptedException {
        accountService.decrease(userId, money);
    }
}
